import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Home from '../views/Home.vue'

export const baseRoutes: Array<any> = [
  {
    path: '/login',
    name: '登录',
    component: () => import(/* webpackChunkName: "about" */ '../views/Login.vue')
  },
  {
    path: '/403',
    name: '403',
    component: () => import('../views/403.vue'),
  },
]

export const routes: Array<any> = [
  {
    path: '/home',
    name: '主页',
    component: Home,
    children: [
      {
        path: '/home/about',
        name: '关于我们',
        meta: {
          auth: 'about',
          btnRoles: []
        },
        component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
      },
      {
        path: '/home/personCenter',
        name: '个人中心',
        meta: {
          auth: 'personCenter',
          btnRoles: []
        },
        component: () => import(/* webpackChunkName: "personCenter" */ '../views/PersonCenter.vue')
      },
      {
        path: '/home/select',
        name: '选择器',
        meta: {
          auth: 'select',
          btnRoles: []
        },
        component: () => import(/* webpackChunkName: "select" */ '../views/Select.vue')
      },
      {
        path: '/home/switch',
        name: '开关',
        meta: {
          auth: 'switch',
          btnRoles: []
        },
        component: () => import(/* webpackChunkName: "switch" */ '../views/Switch.vue')
      },
      {
        path: '/home/transfer',
        name: '穿梭框',
        meta: {
          auth: 'transfer',
          btnRoles: []
        },
        component: () => import(/* webpackChunkName: "transfer" */ '../views/Transfer.vue')
      }
    ]
  },
  {
    path: '/login',
    name: '登录',
    component: () => import(/* webpackChunkName: "about" */ '../views/Login.vue')
  },
  {
    path: '/403',
    name: '403',
    component: () => import('../views/403.vue'),
  }
]

export const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes: routes
})

// export default router
